home *** CD-ROM | disk | FTP | other *** search
/ Amiga Desktop Video CD / Amiga DeskTop Video CD.iso / install / toolalias / source / icon.c < prev    next >
C/C++ Source or Header  |  1994-06-23  |  1KB  |  69 lines

  1. /*
  2.  *  Routines dealing with processing of program's icon
  3.  *  (be they for tooltypes or AppIcon purposes).
  4.  *  
  5.  *  MWS, Tuesday 13-Oct-92
  6.  */
  7. #include <exec/types.h>
  8. #include <dos/dos.h>
  9. #include <workbench/startup.h>
  10. #include <workbench/workbench.h>
  11. #include <proto/exec.h>
  12. #include <proto/dos.h>
  13. #include <proto/wb.h>
  14. #include <proto/icon.h>
  15. #include <string.h>
  16.  
  17. #include "icon.h"
  18. static struct DiskObject *mydiskobj;
  19.  
  20. BOOL
  21. GetOurIcon(struct WBStartup *WBenchMsg)
  22. {
  23.     if (WBenchMsg)
  24.         mydiskobj = GetDiskObject(WBenchMsg->sm_ArgList->wa_Name);
  25.     return mydiskobj ? TRUE : FALSE;
  26. }
  27.  
  28. /* safe to call when open failed, and multiple times */
  29. void
  30. FreeOurIcon()
  31. {
  32.     if (mydiskobj) FreeDiskObject(mydiskobj);
  33.     mydiskobj = NULL;
  34. }
  35.  
  36. /* like ArgString() */
  37. char *
  38. TTString(char *name, char *def)
  39. {
  40.     char *what;
  41.     if (mydiskobj)
  42.         if (what = FindToolType(mydiskobj->do_ToolTypes, name))
  43.             return what;
  44.     return def;
  45. }
  46.  
  47. /* like ArgInt() */
  48. LONG
  49. TTInt(char *name, LONG def)
  50. {
  51.     char *what;
  52.     if (mydiskobj)
  53.         if (what = FindToolType(mydiskobj->do_ToolTypes, name))
  54.             StrToLong(what, &def);
  55.     return def;
  56. }
  57.  
  58. /* simple extension to ArgXXX routines */
  59. BOOL
  60. TTBool(char *name, BOOL def)
  61. {
  62.     char    *s;
  63.  
  64.     s = TTString(name, def ? "YES" : "NO");
  65.  
  66.     return    ((strcmp(s, "YES") == 0) ||
  67.         (strcmp(s, "TRUE") == 0)) ? TRUE : FALSE;
  68. }
  69.